The present invention relates to memory having a plurality of erasure-unit regions in which data are erased or written in predetermined units, and more particularly, to a data processing device using, e.g., flash memory.
Flash memory corresponds to semiconductor memory in which data can be electrically written or from which data can be electrically erased. The flash memory is characterized by the ability to retain memory contents without power supply. Particularly in the field of industrial computers, flash memory is often used as a storage medium substituting for a hard disk.
However, new data cannot be written directly in flash memory. More specifically, data must be collectively erased in units of, for example 64 K (hereinafter referred to as xe2x80x9cerasure unitsxe2x80x9d), before new data are written in the flash memory. After data have been erased in erasure units, new data corresponding to the size of the erased data are written, thus rewriting the data stored in the flash memory.
Particularly, from a structural viewpoint, in large-capacity and high-density flash memory, an erasure unit is larger than the unit for rewriting (hereinafter referred to as a xe2x80x9crewriting unitxe2x80x9d). For this reason, in many cases, data used for rewriting become greater in size than the erasure unit. Even in a case where such data are rewritten into the flash memory, data must erased in erasure units which may comprise data segments which do not need to be rewritten, and the data containing the thus-erased data segments must be written in the flash memory once again.
A technique for rewriting data in flash memory is described in the Unexamined Japanese Patent Application Publication No. Hei 5-233478. FIG. 18 is a block diagram showing the outline of circuitry of the background art. The operation of the circuit will now be described by reference to FIG. 18.
A data rewriting operation of FRAM 4 will be described. Data to be rewritten into the FRAM 4 are downloaded into SRAM 3. Data pertaining to an area of the FRAM 4 which does not need to be subjected to rewriting are copied to a register 5. All the contents of the FRAM 4 are deleted by means of a FRAM clear program stored in EPROM 2. The data that have been downloaded into the SRAM 3 are copied to the FRAM 4. Further, the data which have been saved in the register 5 are copied to the original area on the FRAM 4 which does not need to be subjected to rewriting.
In the prior art, in a case where volatile memory is used as the register 5 which acts as an area into which data are saved at the time of rewriting of the flash memory, in the event that supply of power to the data processing device is interrupted after erasure of data, data pertaining to an area not to be subjected to rewriting, as well as data pertaining to an area to be subjected to rewriting, are lost, thus deteriorating the reliability of flash memory.
In order to prevent loss of the data recorded in the register, the data which have been recorded on the register must be written into flash memory immediately. From an operational viewpoint, flash memory must be erased every time the data stored in flash memory are rewritten. Eventually, flash memory must be subjected to erasing operations in the number corresponding to the number of times data are rewritten. A limitation is imposed on the number of times flash memory can be subjected to erasure (usually 100,000 times or thereabouts). Therefore, the number of times flash memory is subjected to erasure must be diminished. In the background art, however, the number of times flash memory is subjected to erasure is increased, thus shortening the life of flash memory.
The present invention has been conceived to solve such a problem of the prior art and is aimed at providing a data processing device which prevents erasure of data from flash memory when the data recorded in the flash memory are rewritten and exhibits improved reliability when data are written into the flash memory.
The present invention is also aimed at providing a data processing device which diminishes the number of times flash memory is subjected to erasure, through use of a simple structure and while maintaining reliability, in the event of a limitation being imposed on the number of times flash memory is subjected to erasure.
To this end, the present invention provides a data storage method by which data recorded in memory are rewritten through use of memory having a plurality of erasure-unit regions into which data are written in predetermined units and from which data are erased in predetermined units, as well as through use of a nonvolatile erasure block buffer for storing write data to be written into the erasure-unit regions and non-changing data belonging to the erasure-unit regions, the method comprising:
a first erasure block buffer write step of writing first write data into the erasure block buffer, in response to a first write request for requesting writing of the first write data into a first erasure-unit region of the memory;
a second erasure block buffer write step of writing into the erasure block buffer non-changing data recorded in the first erasure-unit region, in response to the first write request for requesting writing of the first write data into the first erasure-unit region of the memory;
an erasure step of erasing the data from the first erasure-unit region after the second erasure block buffer write step; and
a memory write step of writing into the first erasure-unit region the first write data and the non-changing data stored in the erasure block buffer.
By way of example, the present invention is described in connection with a first embodiment (shown in FIG. 3).
Further, the present invention provides a data storage method by which data stored in memory are rewritten through use of memory having a plurality of erasure-unit regions into which data are written in predetermined units and from which data are erased in predetermined units, as well as a nonvolatile erasure block buffer for storing write data to be written into the erasure-unit regions and non-changing data belonging to the erasure-unit regions, the method comprising:
a first erasure block buffer write step of writing first write data into the erasure block buffer, in response to a first write request for requesting writing of the first write data into a first erasure-unit region of the memory;
a second erasure block buffer write step of writing into the erasure block buffer non-changing data recorded in the first erasure-unit region, in response to the first write request for requesting writing of the first write data into the first erasure-unit region of the memory;
a third erasure block buffer write step of writing second write data into the memory, in response to a second write request for requesting writing of the second write data into the memory, after the first erasure block buffer write step; and
a memory write step of writing the data written in the erasure block buffer into the first erasure-unit region after the second erasure block buffer write step and the third erasure block buffer write step.
By way of example, the present invention is described in connection with a second embodiment (shown in FIG. 5).
Preferably, the first erasure block buffer write step is followed by a comparison step of comparing the erasure-unit region into which the first write data are to be written with the erasure-unit region into which the second write data are to be written, and, in a case where a match is obtained as a comparison result in the comparison step, processing pertaining to the third erasure block buffer write step and processing pertaining to the memory write step are performed.
By way of example, the present invention is described in connection with a second embodiment (shown in FIG. 5).
Still further, the present invention provides a data storage method by which data recorded in memory are rewritten through use of memory having a plurality of erasure-unit regions into which data are written in predetermined units and from which data are erased in predetermined units, as well as an erasure block buffer for storing write data to be written into the erasure-unit regions and non-changing data belonging to the erasure-unit regions, the method comprising:
a first erasure block buffer write step of writing first write data into the erasure block buffer, in response to a first write request for requesting writing of the first write data into a first erasure-unit region of the memory;
a second erasure block buffer write step of writing into the erasure block buffer non-changing data recorded in the first erasure-unit region, in response to the first write request for requesting writing of the first write data into the first erasure-unit region of the memory;
an erasure step of erasing the data from the first erasure-unit region after the second erasure block buffer write step; and
a memory write step of writing the data stored in the erasure block buffer into the first erasure-unit region from which the data have been erased in the erasure step, in response to a second write request for requesting writing of second write data into the memory.
By way of example, the present invention is described in connection with a third embodiment (shown in FIG. 7).
Preferably, the erasure step is followed by a comparison step of comparing the erasure-unit region into which the first write data are to be written with the erasure-unit region into which the second write data are to be written, and,
in a case where a match is obtained as a comparison result in the comparison step, processing pertaining to the memory write step is performed.
By way of example, the present invention is described in connection with a third embodiment (shown in FIG. 7).
Furthermore, the present invention provides a data storage method by which data recorded in memory are rewritten, through use of memory having a plurality of erasure-unit regions into which data are written in predetermined units and from which data are erased in predetermined units, a nonvolatile erasure block buffer for storing write data to be written into the erasure-unit regions and non-changing data belonging to the erasure-unit regions, and a write buffer for storing the write data without storing the non-changing data, the method comprising:
an erasure block buffer write step of writing into the erasure block buffer first write data and the non-changing data stored in a first erasure-unit region of the memory, in response to a first write request for requesting writing of the first write data into the first erasure-unit region of the memory;
a first write buffer write step of writing second write data into the write buffer, in response to a second write request for requesting writing of the second write data into a second erasure-unit region of the memory, after the erasure block buffer write step; and
a second write buffer write step of writing third write data into the write buffer, in response to a third write request for requesting writing of the third write data into an erasure-unit region of the memory, after the first write buffer write step.
By way of example, the present invention is described in connection with a forth embodiment (shown in FIG. 10).
Preferably, the data storage method further comprises a comparison step of comparing a write request region for specifying a location in the memory in which the second write data are to be written with a write request region for specifying a location in the memory in which the third write data are to be written, and,
in a case where the write request region into which the third write data are to be written is included in the write request region in which the second write data are to be written, in the second write buffer write step the third write data are written over the area of the write buffer in which the second write data are written.
By way of example, the present invention is described in connection with a forth embodiment (shown in FIG. 10).
The present invention also provides a data storage method by which data recorded in memory are rewritten through use of memory having a plurality of erasure-unit regions into which data are written in predetermined units and from which data are erased in predetermined units, a nonvolatile erasure block buffer for storing write data to be written into the erasure-unit regions and non-changing data belonging to the erasure-unit regions, and a write buffer for storing the write data without storing the non-changing data, the method comprising:
a first erasure block buffer write step of writing into the erasure block buffer first write data and the non-changing data stored in a first erasure-unit region of the memory, in response to a first write request for requesting writing of the first write data into the first erasure-unit region of the memory;
a first write buffer write step of writing second write data into the write buffer, in response to a second write request for requesting writing of the second write data into a second erasure-unit region of the memory, after the first erasure block buffer write step;
a memory write step of writing into the first erasure-unit region the first write data written in the erasure block buffer and the non-changing data after the first write buffer write step, in a case where there arises a third write request for requesting writing third write data into an erasure-unit region of the memory; and
a second erasure block buffer write step of writing into the erasure block buffer the second write data, the third write data, and the non-changing data stored in the second erasure-unit region, after the memory write step.
By way of example, the present invention is described in connection with a fifth embodiment (shown in FIGS. 13 and 14).
Preferably, the first erasure block buffer write step is followed by a comparison step of comparing the erasure-unit region into which the second write data are to be written with the erasure-unit region into which the third write data are to be written, and,
in a case where a match is obtained as a comparison result in the comparison step, processing pertaining to the third erasure block buffer write step and processing pertaining to the memory write step are performed.
By way of example, the present invention is described in connection with a fifth embodiment (shown in FIGS. 13 and 14).
The present invention provides a data processing device which includes memory having a plurality of erasure-unit regions into which data are written in predetermined units and from which data are erased in predetermined units, and erasure means for erasing the data stored in the erasure-unit regions in the predetermined units and which rewrites the data stored in the erasure-unit region through use of first write data, the processing device comprising:
a nonvolatile block buffer which permits writing of data in arbitrary units;
write data write means for writing the first write data into the erasure block buffer;
save means for writing, into the erasure block buffer, non-changing data which are not to be rewritten by the first write data from among the data stored in the erasure-unit region of the memory; and
memory write means for writing the first write data and the non-changing data, both data sets being written into the erasure block buffer, into the erasure-unit region from which the data have been erased by the erasure means.
By way of example, the present invention is described in connection with a first embodiment (shown in FIG. 1).
The present invention further provides a data processing device which rewrites data stored in memory, through use of memory having a plurality of erasure-unit regions into which data are written in predetermined units and from which data are erased in predetermined units, as well as an erasure block buffer for storing both write data to be written into the erasure-unit region and non-changing data stored in the erasure-unit region, the device comprising:
write data write means for writing first write data into the erasure block buffer, in response to a first write request for requesting writing of the first write data into a first erasure-unit region of the memory;
save means for writing into the erasure block buffer non-changing data stored in the first erasure-unit region, in response to the first request for requesting writing of the first write data into the first erasure-unit region of the memory;
memory write means for writing into the first erasure-unit region the data written in the erasure block buffer;
the erasure block buffer retaining the first write data and the non-changing data stored in the first erasure-unit region, until a second write request is issued after the first write request; and
the write data write means writing the second write data into the erasure block buffer in a case where the second write request requests writing of the second write data into the first erasure-unit region, and the memory write means writing, to the first erasure-unit region, data belonging to the erasure block buffer in which the second write data are written.
By way of example, the present invention is described in connection with a second embodiment (shown in FIG. 4).
The present invention further provides a data processing device which rewrites data stored in memory, through use of memory having a plurality of erasure-unit regions into which data are written in predetermined units and from which data are erased in predetermined units, an erasure block buffer for storing both write data to be written into the erasure-unit region and non-changing data stored in the erasure-unit region, and a write buffer for storing the write data without storing the non-changing data, the device comprising:
write data write means for writing first write data into the erasure block buffer, in response to a first write request for requesting writing of the first write data into a first erasure-unit region of the memory;
save means for writing into the erasure block buffer non-changing data stored in the first erasure-unit region, in response to the first request for requesting writing of the first write data into the first erasure-unit region of the memory;
write buffer write means for writing second write data into the write buffer, in response to a second write request for writing the second write data into a second erasure-unit region of the memory;
the write buffer retaining the second write data until a third write request is issued after the second write request; and
the write buffer write means writing the third write data into the write buffer in a case where the third write request requests writing of the third write data into the write request region for the second write data.
By way of example, the present invention is described in connection with a forth embodiment (shown in FIGS. 8 to 10).
The present invention provides a data processing device including:
first memory having a plurality of erasure-unit regions into which data are written and from which data are deleted in predetermined erasure units, and
erasure means for deleting the data stored in the erasure-unit region in the erasure units, the data stored in the erasure-unit region being converted into first write data, the data processing device comprising:
nonvolatile second memory which has an erasure block buffer, an erasure-unit-number hold region, and an erasure-unit-number validation region and which can write data in arbitrary data units;
save means for writing, into the erasure-block buffer, non-changing data which constitute a portion of the data stored in the erasure unit regions and are not rewritten by the first write data;
write control means for writing into the erasure-unit-number hold region information for specifying an erasure-unit region into which the first write data are to be written, writing the first write data into the erasure-block buffer, and writing into the erasure-unit-number validation region information corresponding to the information written into the erasure-unit-number hold region after completion of writing of the first write data and the non-changing data;
memory write means for writing the first write data written into the erasure-block buffer and the non-changing data into the erasure-unit regions; and
recovery means for recovering the data processing device on the basis of information pertaining to the erasure-unit-number hold region and the erasure-unit-number validation region. By way of example, the present invention is described in connection with a seventh embodiment (shown in FIGS. 19 to 21).
Preferably, the second memory has an erasure-block buffer validation region into which is to be written a data check value, which is obtained as a result of processing of the data stored in the erasure-block buffer;
the write control means writes the data check value into the erasure-block-buffer validation region; and
the recovery means performs a recovery operation on the basis of the value stored in the erasure-unit-number hold region, the value stored in the erasure-unit-number validation region, and the data check value stored in the erasure-block-buffer validation region. By way of example, the present invention is described in connection with an eighth embodiment (shown in FIGS. 22 to 24).
The present invention also provides a data processing device including:
first memory having a plurality of erasure-unit regions into which data are written and from which data are deleted in predetermined erasure units, and
erasure means for deleting the data stored in the erasure-unit region in the erasure units, the data stored in the erasure-unit region being converted into first write data, the data processing device comprising:
nonvolatile second memory which has an erasure block buffer and a write inhibition flag region and can write data in arbitrary data units;
write control means which, in response to a first write request for requesting writing of the first write data into a first erasure-unit region of the first memory, writes the first write data into the erasure-block buffer in a case where a value stored in the write inhibition flag region shows a write enable state;
save means which, in response to the first write request, writes non-changing data stored in the first erasure-unit region into the erasure-block buffer in a case where a value stored in the write inhibition flag region shows a write enable state; and
memory write means which writes the data stored in the erasure-block buffer into the first memory in a case where a value stored in the write inhibition flag region shows a write enable state. By way of example, the present invention is described in connection with a ninth embodiment (shown in FIGS. 25 to 28).
Preferably, the erasure-block buffer retains the first write data and the non-changing data in the first erasure-unit region until a second write request arises after the first write request for requesting writing of the first write data; and
in a case where the second write request requests writing second write data into the first erasure-unit region, the write control means writes the second write data into the erasure-block buffer, and the memory write means writes into the first erasure-unit region data stored in the erasure-block buffer in which the second write data have been written. By way of example, the present invention is described in connection with a tenth embodiment (shown in FIGS. 29 to 31).
Preferably, the write control means deletes data from the erasure-unit-number hold means and data from the erasure-unit-number validation means after completion of writing the data stored in the erasure-block buffer into the erasure-unit region of the first memory. By way of example, the present invention is described in connection with the seventh embodiment (shown in FIG. 20) and in the tenth embodiment (shown in FIG. 30).
Preferably, in a case where the value stored in the erasure-unit-number hold region coincides with the value stored in the erasure-unit-number validation region, the recovery means instructs the memory write means to write the first write data and the non-changing data, both data sets being written in the erasure-block buffer, into the erasure-unit region of the first memory through use of the erasure means. By way of example, the present invention is described in connection with the seventh embodiment (shown in FIG. 21) and the tenth embodiment (shown in FIG. 31).
Preferably, in a case where the value stored in the erasure-unit-number hold region does not coincide with the value stored in the erasure-unit-number validation region, the recovery means deletes the value from the erasure-unit-number hold region and the value from the erasure-unit-number validation region. By way of example, the present invention is described in connection with the seventh embodiment (shown in FIG. 21) and an eleventh embodiment (shown in FIG. 32).
Preferably, the second memory has an erasure-block-buffer management region which manages the regions stored in the erasure-block buffer in a divided manner and into which is to be stored a data check value, which would be obtained as a result of processing of data belonging to the divided regions;
the write control means writes the data check value into the erasure-block-buffer validation region; and
the recovery means performs a recovery operation on the basis of the value stored in the erasure-unit-number hold region, the value stored in the erasure-unit-number validation region, and the data check value stored in the erasure-block-buffer validation region. By way of example, the present invention is described in connection with a twelfth embodiment (shown in FIG. 34) and a thirteenth embodiment (shown in FIG. 39).
Preferably, in a case where a write request region of the second write data coincides with the divided regions managed in the erasure-block-buffer management region, the write control means rewrites the data check value. By way of example, the present invention is described in connection with the thirteenth embodiment (shown in FIGS. 39 to 42).
Preferably, in a case where the data requested to be read are stored in the erasure-block buffer, the data processing device further comprises:
reading means for reading data from the erasure-block buffer in a case where the data requested to be read are stored in the erasure-block buffer. In a case where data stored in the erasure-block buffer are determined to be correct on the basis of the data check value stored in the erasure-block-buffer management region, the reading means reads data from the erasure-block buffer. By way of example, the present invention is described in connection with a fourteenth embodiment (shown in FIG. 43).
Preferably, in a case where the data requested to be read are stored in the erasure-block buffer, the data processing device further comprises:
reading means for reading data from the erasure-block buffer in a case where the data requested to be read are stored in the erasure-block buffer. In a case where data stored in the erasure-block buffer are determined to be incorrect on the basis of the data check value stored in the erasure-block-buffer management region, the reading means reads data from the first memory. By way of example, the present invention is described in connection with a fifteenth embodiment (shown in FIG. 44).
The present invention provides a data processing device including:
first memory having a plurality of erasure-unit regions into which data are written and from which data are deleted in predetermined erasure units, and
erasure means for deleting the data stored in the erasure-unit region in the erasure units, the data processing device comprising:
nonvolatile second memory which can write data in arbitrary data units and has an erasure-block buffer for storing write data to be written into the erasure-unit region and non-changing data stored in the erasure-unit region, a write buffer for storing write data without storage of non-changing data, a region for retaining a first data check value which is obtained as a result of processing of the data stored in the erasure-block buffer, and a region for retaining a second data check value which is obtained as a result of processing of the data written into the write buffer;
write control means which writes the first write data into the erasure-block buffer in response to a first write request for requesting writing of first write data into the first erasure-unit region, writes the second write data into the write buffer in response to a second write request for requesting writing of second write data into the second erasure-unit region, and writes the first data check value and the second data check value into the second memory;
save means for writing non-changing data stored in the first erasure-unit region into the erasure-block buffer in response to the first write request;
memory write means for writing the first write data and the non-changing data, both data sets being written in the erasure-block buffer, into the first erasure-unit region from which data have been deleted by the erasure means; and
recovery means which recovers the data processing device on the basis of the first data check value and the second data check value, both values being written in the second memory. By way of example, the present invention is described in connection with a sixteenth embodiment (shown in FIGS. 45 to 49).
Preferably, the recover means instructs the memory write means to write the data stored in the erasure-block buffer into the first erasure-unit region in a case where the data stored in the erasure-block buffer are determined to be correct on the basis of the first data check value, instructs the write control means to write the second write data stored in the write buffer into the erasure-block buffer in a case where the data stored in the write buffer are determined to be correct on the basis of the second data check value, and instructs the save means to write into the erasure-block buffer the non-changing data stored in the second erasure-unit region. By way of example, the present invention is described in connection with a seventeenth embodiment (shown in FIG. 50).
Preferably, the data processing device further comprises third memory which has an erasure-unit-number hold region and reds data at a higher speed than does the second memory;
the write control means writing information for specifying the erasure-unit region into the erasure-unit-number hold region of the second memory and into the erasure-unit-number hold region of the third memory. When the information for specifying the erasure-unit region is referred to, data are read from the erasure-unit-number hold region of the third memory. By way of example, the present invention is described in connection with an eighteenth embodiment (shown in FIGS. 51 to 54).
The present invention provides a data processing device including:
first memory having a plurality of erasure-unit regions into which data are written and from which data are deleted in predetermined erasure units, and
erasure means for deleting the data stored in the erasure-unit region in the erasure units, the data stored in the erasure-unit region being converted into first write data, the data processing device comprising:
nonvolatile second memory which can write data in arbitrary data units and has an erasure-block buffer for storing the first write data and non-changing data stored in the erasure-unit region and a write buffer for storing write data without storage of non-changing data;
save means for writing non-changing data stored in the first erasure-unit region into the erasure-block buffer in response to the first write request;
buffer write means for writing a plurality of write data sets into the write data buffer in response to a plurality of write requests other than the first write request;
memory write means for writing the first write into the first erasure-unit region data and the non-changing data, both data sets being written in the erasure-block buffer write means; and
data transfer means which calculates the amount of the plurality of write data sets stored in the write buffer, for each erasure-unit region for which a write request has been issued, and which transfers into the erasure-block buffer all the data sets to be written into a single erasure-unit region on the basis of the calculation result, wherein
the save means writes into the erasure-block buffer non-changing data, which are stored in the erasure-unit region and correspond to the write data having been transferred to the erasure-block buffer. By way of example, the present invention is described in connection with a nineteenth embodiment (shown in FIGS. 55 and 56).
Preferably, in a case where, from among the write data stored in the write buffer, the amount of the write data requested to be written into a single erasure-unit region is smaller than a predetermined amount and where the amount of the write data is greater than a predetermined amount, the data transfer means transfers all the write data into the erasure-block buffer. By way of example, the present invention is described in connection with a twentieth embodiment (shown in FIG. 57).